﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CSModeling
{
    public partial class Form_PhongParam : Form
    {
        private SMFModel.PhongPara para;
        public Form_PhongParam(SMFModel.PhongPara para)
        {
            InitializeComponent();
            this.para = para;
            this.textBox1.Text = para.Iar.ToString();
            this.textBox2.Text = para.Iag.ToString();
            this.textBox3.Text = para.Iab.ToString();

            this.textBox6.Text = para.Ipr.ToString();
            this.textBox5.Text = para.Ipg.ToString();
            this.textBox4.Text = para.Ipb.ToString();

            this.textBox9.Text = para.Kar.ToString();
            this.textBox8.Text = para.Kag.ToString();
            this.textBox7.Text = para.Kab.ToString();

            this.textBox12.Text = para.Kdr.ToString();
            this.textBox11.Text = para.Kdg.ToString();
            this.textBox10.Text = para.Kdb.ToString();

            this.textBox15.Text = para.Ksr.ToString();
            this.textBox14.Text = para.Ksg.ToString();
            this.textBox13.Text = para.Ksb.ToString();

            this.textBox19.Text = para.Light.X.ToString();
            this.textBox18.Text = para.Light.Y.ToString();
            this.textBox17.Text = para.Light.Z.ToString();

            this.textBox21.Text = para.View.X.ToString();
            this.textBox20.Text = para.View.Y.ToString();
            this.textBox16.Text = para.View.Z.ToString();
            this.trackBar1.Value = (int)para.n;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            para.Iar = Convert.ToDouble(textBox1.Text);
            para.Iag = Convert.ToDouble(textBox2.Text);
            para.Iab = Convert.ToDouble(textBox3.Text);

            para.Ipr = Convert.ToDouble(textBox6.Text);
            para.Ipg = Convert.ToDouble(textBox5.Text);
            para.Ipb = Convert.ToDouble(textBox4.Text);

            para.Kar = Convert.ToDouble(textBox9.Text);
            para.Kag = Convert.ToDouble(textBox8.Text);
            para.Kab = Convert.ToDouble(textBox7.Text);

            para.Kdr = Convert.ToDouble(textBox12.Text);
            para.Kdg = Convert.ToDouble(textBox11.Text);
            para.Kdb = Convert.ToDouble(textBox10.Text);

            para.Ksr = Convert.ToDouble(textBox15.Text);
            para.Ksg = Convert.ToDouble(textBox14.Text);
            para.Ksb = Convert.ToDouble(textBox13.Text);

            para.Light.X = Convert.ToDouble(textBox19.Text);
            para.Light.Y = Convert.ToDouble(textBox18.Text);
            para.Light.Z = Convert.ToDouble(textBox17.Text);

            para.View.X = Convert.ToDouble(textBox21.Text);
            para.View.Y = Convert.ToDouble(textBox20.Text);
            para.View.Z = Convert.ToDouble(textBox16.Text);

            para.n = trackBar1.Value;
            this.Close();
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}